<?php


@include_once('./database.php');



// 删除  根据用户名和商品id 
$uname = $_POST['username'];
$id = $_POST['id'];

$obj = [];

if ($uname && $id) {
    $sql = "delete from cart where user_name = '$uname' and goods_id = $id";
    mysqli_query($connect, $sql);
    $rows = mysqli_affected_rows($connect);
    if ($rows > 0) {
        $obj['status'] = true;
        $obj['msg'] = '删除成功';
    } else {
        $obj['status'] = false;
        $obj['msg'] = '删除失败';
    }
} else {
    $obj['status'] = false;
    $obj['msg'] = '前端数据有误';
}




echo (json_encode($obj, JSON_UNESCAPED_UNICODE));
